package com.example.doctorstation.POJOMapper;
import java.util.Date;
import java.util.List;
import com.example.doctorstation.POJOData.*;
import org.apache.ibatis.annotations.*;

@Mapper
public interface PatientAdviceMapper {
    //获取医嘱
    @Select("call getPatientAdvice(#{arg0})")
    public List<PatientAdvice> getPatientAdvice(Integer patientID);

    //新增医嘱
    @Insert("insert into p_patient_advice(PATIENTID,INHOSPITALINFOID,PSTART_DATE,PEXECUTE_DATE,PSTOP_DATE,PADVICE_STATUS,PEXECUTE_DEPT_ID," +
            "PEXECUTE_DEPT_NAME,PDOCTOR_ID,PDOCTOR_NAME,PDRUG_SIZE,PDRUG_ID,PDRUG_NAME,PADVICE_FREQUENCY,PDRUG_UNIT,PDRUG_USAGE," +
            "PDRUG_ENTRUST,PDRUG_DOSE,PADVICE_TYPE,PCHECK_DOCTOR_ID,PCHECK_DOCTOR_NAME,PSTOP_DOCTOR_ID,PSTOP_DOCTOR_NAME) " +
            "values(#{PATIENTID},#{INHOSPITALINFOID},#{PSTART_DATE},#{PEXECUTE_DATE},#{PSTOP_DATE},#{PADVICE_STATUS},#{PEXECUTE_DEPT_ID},#{PEXECUTE_DEPT_NAME},#{PDOCTOR_ID},#{PDOCTOR_NAME},#{PDRUG_SIZE},#{PDRUG_ID},#{PDRUG_NAME},#{PADVICE_FREQUENCY},#{PDRUG_UNIT},#{PDRUG_USAGE},#{PDRUG_ENTRUST},#{PDRUG_DOSE},#{PADVICE_TYPE},#{PCHECK_DOCTOR_ID},#{PCHECK_DOCTOR_NAME},#{PSTOP_DOCTOR_ID},#{PSTOP_DOCTOR_NAME})")
    public Integer addPatientAdvice(PatientAdvice advice);

    //改变医嘱状态
    @Select("call updatePatientAdviceStatus(#{arg0},#{arg1})")
    public Integer updatePatientAdviceStatus(Integer AdviceID,String status);

    //查看此住院号包含的医嘱数量
    @Select("select count(PADVICE_ID) from p_patient_advice where INHOSPITALINFOID = #{arg0};")
    public Integer getPatientAdviceCount(Integer INHOSPITALINFOID);
}
